package com.tomato.thread.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import static java.text.MessageFormat.format;

/**
 * @author tomato
 */
public class CacheThreadPoool {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newCachedThreadPool();

        for(int i = 0; i < 1_000; i++) {
            executorService.execute(() -> {
                System.out.println(format("{0}执行任务",Thread.currentThread().getName()));
            });
        }
    }
}
